package c.e.b.h.e.k;

import c.e.b.h.e.n.b;
import c.e.b.h.e.n.c;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;

/* compiled from: AbstractSpiCall */
public abstract class a {
    public static final Pattern e = Pattern.compile("http(s?)://[^\\/]+", 2);
    public final String a;
    public final c b;
    public final c.e.b.h.e.n.a c;
    public final String d;

    public a(String str, String str2, c cVar, c.e.b.h.e.n.a aVar) {
        if (str2 == null) {
            throw new IllegalArgumentException("url must not be null.");
        } else if (cVar != null) {
            this.d = str;
            if (!g.r(str)) {
                str2 = e.matcher(str2).replaceFirst(str);
            }
            this.a = str2;
            this.b = cVar;
            this.c = aVar;
        } else {
            throw new IllegalArgumentException("requestFactory must not be null.");
        }
    }

    public b b() {
        return c(Collections.emptyMap());
    }

    public b c(Map<String, String> map) {
        c cVar = this.b;
        c.e.b.h.e.n.a aVar = this.c;
        String str = this.a;
        Objects.requireNonNull(cVar);
        b bVar = new b(aVar, str, map);
        bVar.d.put("User-Agent", "Crashlytics Android SDK/17.2.2");
        bVar.d.put("X-CRASHLYTICS-DEVELOPER-TOKEN", "470fa2b4ae81cd56ecbcda9735803434cec591fa");
        return bVar;
    }
}
